﻿using System;
using System.Collections.Generic;
using System.Text;
using T.FAS.Runtime.Base.Entity;
using T.FAS.Runtime.Metadata.Entity.DataModel;

namespace T.FAS.Runtime.StateMachine.SPI
{
    public interface IRuleProcess
    {
        /// <summary>
        /// 标识
        /// </summary>
        string Key { get; }

        /// <summary>
        /// 描述
        /// </summary>
        string Description { get; }

        /// <summary>
        /// 是否在界面状态转换时执行规则的预处理
        /// </summary>
        bool IsPreCheck { get; }

        /// <summary>
        /// 需要复制的参数信息
        /// </summary>
        List<ParamInfo> NeedParamInfo { get; }

        /// <summary>
        /// 逻辑控制
        /// </summary>
        /// <param name="record">目标结果集</param>
        /// <param name="state">状态</param>
        /// <param name="rule">规则</param>
        /// <param name="metadata">状态机元数据</param>
        /// <param name="failReason">逻辑控制失败原因</param>
        /// <returns></returns>
        bool Check(TRecord record, TState state,TRule rule,StateMachineMetadata metadata,StringBuilder failReason);
    }
}
